﻿




function addUTab(href, ye, title, icon) {
    if (icon != "") {
        var classname = "icon_" + ye;
        F.util.addCSS(classname, '.' + classname + '{background: url(' + icon + ') no-repeat;}');
    }
    var mainTabStrip = Ext.getCmp(IDS.mainTabStrip);
    var openNewWindowButton = new Ext.Button({
        text: '新标签页中打开',
        type: "button",
        cls: "x-btn-text-icon",
        icon: "/res.axd?icon=TabGo",
        listeners: {
            click: function (button, e) {
                window.open(href, "_blank");
                e.stopEvent();
            }
        }
    });

    var refreshButton = new Ext.Button({
        text: '刷新',
        type: "button",
        cls: "x-btn-text-icon",
        icon: "/res.axd?icon=Reload",
        listeners: {
            click: function (button, e) {
                // 注意：button.ownerCt 是工具栏，button.ownerCt.ownerCt 就是当前激活的标签页。
                Ext.DomQuery.selectNode('iframe', button.ownerCt.ownerCt.getEl().dom).contentWindow.location.reload(); //.replace(href);
                e.stopEvent();
            }
        }
    });

    // 动态添加一个带工具栏的标签页
    var tabId = 'dynamic_added_tab_' + ye
    var currentTab = mainTabStrip.getTab(tabId);
    if (!currentTab) {
        mainTabStrip.addTab({
            'id': tabId,
            'url': href,
            'title': title,
            'closable': true,
            'bodyStyle': 'padding:0px;',
            'iconCls': classname
        });
    } else {
        mainTabStrip.setActiveTab(currentTab);
    }
}




